package com.example.lvsuo.controller.cxg;

import com.example.lvsuo.modal.Result;
import com.example.lvsuo.service.cxg.StatisticsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.builders.ValidationResult;

import java.util.List;
import java.util.Map;

/**
 * 统计
 */
@RestController
@RequestMapping("statistics")
public class StatisticsController {

    @Autowired
    StatisticsService statisticsService;

    /**
     * 财务 统计
     * @param map
     * @return
     */
    @GetMapping
    public Result queryStatistics(@RequestParam Map<String,Object> map){
        Map<String,Object> StatisticsData = statisticsService.queryStatistics(map);
        return Result.back("ok","20000",StatisticsData);
    }

    /**
     * 创收统计
     * @param map
     * @return
     */
    @GetMapping("/CreateIncome")
    public Result queryCreateIncome(@RequestParam Map<String,Object> map){
//        System.out.println("参数为:"+map);
        List<Map<String,Object>> maps = statisticsService.queryCreateIncome(map);
        return  Result.back("ok","20000",maps);
    }

    /**
     * 创收提成统计
     * @param map
     * @return
     */
    @GetMapping("/Commission")
    public Result queryCommission(@RequestParam Map<String,Object> map){
//        System.out.println("参数为:"+map);
        List<Map<String,Object>> maps = statisticsService.queryCommission(map);
        return  Result.back("ok","20000",maps);
    }

    /**
     * 查询员工个人 工资情况
     * @param map
     * @return
     */
    @GetMapping("/empGongZi")
    public Result queryEmpGongZi(@RequestParam Map<String,Object> map){
        Map<String,Object> gognzi = statisticsService.queryEmpGongZi(map);
        return Result.back("ok","20000",gognzi);
    }

    /**
     * 案件统计
     * @param map
     * @return
     */
    @GetMapping("/CaseTongJi")
    public Result queryCase(@RequestParam Map<String,Object> map){
//        System.out.println("接受参数为=="+map);
        PageHelper.startPage(Integer.valueOf(map.get("pageCur").toString()),Integer.valueOf(map.get("pageSize").toString()));
        PageInfo pageInfo = new PageInfo(statisticsService.queryCase(map));
        return Result.back("ok","20000",pageInfo);
    }

    /**
     * 用印统计
     * @param map
     * @return
     */
    @GetMapping("/sealTongji")
    public Result querySeal(@RequestParam Map<String,Object> map){
//        System.out.println("接受参数为=="+map);
        PageHelper.startPage(Integer.valueOf(map.get("pageCur").toString()),Integer.valueOf(map.get("pageSize").toString()));
        PageInfo pageInfo = new PageInfo(statisticsService.querySeal(map));
        return Result.back("ok","20000",pageInfo);
    }

    @GetMapping("/lsYeWuShouFei")
    public Result querylsYeWuShouFei(@RequestParam Map<String,Object> map){
        List<Map<String,Object>> lsyewushoufei = statisticsService.querylsYeWuShouFei(map);
        return Result.back("ok","20000",lsyewushoufei);
    }

}
